document.getElementById('collect').addEventListener('click', () => {
    chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
        chrome.tabs.sendMessage(tabs[0].id, { action: 'getProductInfo' }, (response) => {
            const resultDiv = document.getElementById('result');
            if (response) {
                resultDiv.innerHTML = `
          <p><strong>标题:</strong> ${response.title}</p>
          <p><strong>价格:</strong> ${response.price}</p>
          <p><strong>图片:</strong> <img src="${response.image}" width="100"></p>
        `;
            } else {
                resultDiv.innerHTML = '<p>无法获取商品信息</p>';
            }
        });
    });
});
